package com.samphanie.auiu.admin.feign;

import com.samphanie.auiu.common.dto.*;
import com.samphanie.auiu.common.utils.ApiResponse;
import feign.Response;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.Map;

/**
 * @author ZSY
 * @email 1451691457@qq.com
 */
@FeignClient("auiu-auth")
public interface IAuiuAuthService {

    @GetMapping("/clients")
    ApiResponse<?> findAllClients();

    @PostMapping("/clients")
    ApiResponse<?> addClient(@RequestBody CreateOrUpdateClientDto client);

    @PutMapping("/clients/{clientId}")
    ApiResponse<?> updateClient(@PathVariable String clientId, @RequestBody CreateOrUpdateClientDto client);

    @DeleteMapping("/clients/{clientId}")
    ApiResponse<?> deleteClient(@PathVariable String clientId);

    @GetMapping("/admin/users")
    ApiResponse<?> findAllUsers(@RequestParam Map<String, Object> parameters);

    @GetMapping( "/admin/user/checkUsername")
    ApiResponse<?> checkUsername(@RequestParam String username);
    @GetMapping( "/admin/user/checkEmail")
    ApiResponse<?> checkEmail(@RequestParam String email);
    @GetMapping( "/admin/user/checkMobile")
    ApiResponse<?> checkMobile(@RequestParam String mobile);

    @GetMapping("/users/{username}")
    ApiResponse<?> findByUsername(@PathVariable String username);

    @PostMapping("/admin/user/create")
    ApiResponse<?> createUser(@Valid @RequestBody CreateUserDto createUserDto);

    @PutMapping("/admin/user/update")
    ApiResponse<?> updateUser(@Valid @RequestBody UpdateUserDto userDto);

    @DeleteMapping("/admin/user/delete")
    ApiResponse<?> deleteUser(@RequestBody Long[] ids);

    @PutMapping("/users/{username}")
    ApiResponse<?> updateRoles(@PathVariable String username, @Valid @RequestBody UserProfileDto userProfileDto);

    @PutMapping("/users/{username}/enabled")
    ApiResponse<?> toggleUserEnabled(@PathVariable String username);

    @GetMapping("/{username}/roles/available")
    ApiResponse<?> getUserAvailableRoles(@PathVariable String username);

    @GetMapping("/code/getImageCode")
    Response getImageCode();

    @PostMapping(value = "/auth/admin/login")
    ApiResponse<?> adminLogin(@RequestBody AdminLoginDto loginDto);

    @GetMapping(value = "/user/me")
    ApiResponse<?> getProfile();
}
